package org.agile2soft.nexoma.expedient.entity;


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "PHASE", uniqueConstraints = @UniqueConstraint(columnNames = "FAS_NAME"))
@SuppressWarnings({"serial"})
public class ExpedientPhase implements java.io.Serializable {

    private Integer id;
    private String name;
    private String description;
    private Set<ExpedientTypePhase> expedientTypePhases = new HashSet<ExpedientTypePhase>(0);
    private Set<ExpedientTypePhaseExpedients> expedientTypePhasesExpedients = new HashSet<ExpedientTypePhaseExpedients>(0);

    public ExpedientPhase() {
    }

    public ExpedientPhase(String name) {
        this.name = name;
    }

    public ExpedientPhase(String name, String description,
            Set<ExpedientTypePhase> expedientTypePhases,
            Set<ExpedientTypePhaseExpedients> expedientTypePhasesExpedients) {
        this.name = name;
        this.description = description;
        this.expedientTypePhases = expedientTypePhases;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "FAS_ID", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer fasId) {
        this.id = fasId;
    }

    @Column(name = "FAS_NAME", unique = true, nullable = false, length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "FAS_DESCRIPTION", length = 150)
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "phase")
    public Set<ExpedientTypePhase> getExpedientTypePhases() {
        return this.expedientTypePhases;
    }

    public void setExpedientTypePhases(
            Set<ExpedientTypePhase> expedientTypePhases) {
        this.expedientTypePhases = expedientTypePhases;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "phase")
    public Set<ExpedientTypePhaseExpedients> getExpedientTypePhasesExpedients() {
        return this.expedientTypePhasesExpedients;
    }

    public void setExpedientTypePhasesExpedients(
            Set<ExpedientTypePhaseExpedients> expedientTypePhasesExpedients) {
        this.expedientTypePhasesExpedients = expedientTypePhasesExpedients;
    }
}
